<?php /* Smarty version 2.6.27, created on 2019-11-05 01:58:55
         compiled from permit/permit_list.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 't', 'permit/permit_list.tpl', 7, false),)), $this); ?>
<style type="text/css">
    #permit_list_table td, th{text-align:left;}
</style>

<table id="permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
" class="itable">
    <tr>
        <th><h2><?php echo ((is_array($_tmp='组')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</h2></th>
        <th><h2><?php echo ((is_array($_tmp='名称')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</h2></th>
        <th><h2><?php echo ((is_array($_tmp='模块')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</h2></th>
        <th><h2><?php echo ((is_array($_tmp='操作')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</h2></th>
    </tr>

    <?php $_from = $this->_tpl_vars['list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['group'] => $this->_tpl_vars['item']):
?>
        <tr ><td colspan="4"><h3><?php echo $this->_tpl_vars['group']; ?>
</h3></td></tr>
            <?php $_from = $this->_tpl_vars['item']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['name'] => $this->_tpl_vars['row']):
?>
                <tr id="permit_line_<?php echo $this->_tpl_vars['row']['pid']; ?>
">
                    <td></td>
                    <td class="edit" id="<?php echo $this->_tpl_vars['row']['pid']; ?>
" field="name"><?php echo $this->_tpl_vars['row']['name']; ?>
</td>
                    <td class="edit_textarea" id="<?php echo $this->_tpl_vars['row']['pid']; ?>
" field="modules"><?php echo $this->_tpl_vars['row']['modules_show']; ?>
</td>
                    <td><a href="javascript:void(0)" onclick="permit_delete(<?php echo $this->_tpl_vars['row']['pid']; ?>
)"><?php echo ((is_array($_tmp='删除')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
</a></td>
                </tr>
            <?php endforeach; endif; unset($_from); ?>
        <tr><td colspan="4"><hr /></td></tr>
    <?php endforeach; endif; unset($_from); ?>
</table>


<script type="text/javascript">
    $('#permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
 tr:even').addClass('even');
    $('#permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
 tr:odd').addClass('odd');
    $("#permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
 tr").hover(
            function () {
                $(this).addClass("hover");
            },
            function () {
                $(this).removeClass("hover");
            }
    );

    $('#permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
 .edit').editable("admin.php?ctrl=permit&act=save_field", {
        indicator : "<img src='style/images/indicator.gif'>",
        height    : "15px",
        submit    : "<?php echo ((is_array($_tmp='修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
        cancel    : "<?php echo ((is_array($_tmp='取消')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
        tooltip   : "<?php echo ((is_array($_tmp='点击修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
...",
        style  : "inherit"
    });

    $('#permit_list_table_<?php echo $this->_tpl_vars['type']; ?>
 .edit_textarea').editable("admin.php?ctrl=permit&act=save_field", {
        indicator : "<img src='style/images/indicator.gif'>",
        height    : "55px",
        submit    : "<?php echo ((is_array($_tmp='修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
        cancel    : "<?php echo ((is_array($_tmp='取消')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
",
        tooltip   : "<?php echo ((is_array($_tmp='点击修改')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
...",
        type: "textarea",
        loadurl   : "admin.php?ctrl=permit&act=get_module_textarea",
        style  : "inherit"
    });

    function permit_delete(pid){
        $.dialog.confirm('<?php echo ((is_array($_tmp='你确定要删除这个吗？')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
', function(){
            $.ajax({
                type: "POST",
                url: "admin.php?ctrl=permit&act=permit_delete",
                data: 'pid='+pid,
                timeout: 20000,
                error: function(){$.dialog.alert('<?php echo ((is_array($_tmp='超时')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');},
                success: function(result){
                    if(result == 'success'){
                        $.dialog.tips('<?php echo ((is_array($_tmp='删除成功')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');
                        $('#permit_line_'+pid).remove();
                    }else{
                        $.dialog.alert('<?php echo ((is_array($_tmp='删除失败')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');
                    }

                }
            });
        }, function(){
            $.dialog.tips('<?php echo ((is_array($_tmp='取消操作')) ? $this->_run_mod_handler('t', true, $_tmp) : t($_tmp)); ?>
');
        });
    }
</script>